package com.example.locationtest

import android.content.Intent
import com.sscl.baselibrary.activity.BasePermissionCheckActivity
import com.sscl.baselibrary.exts.startActivityWithFinish

class PermissionCheckActivity : BasePermissionCheckActivity() {

    override fun needHideNavigationBar(): Boolean {
      return true
    }

    /**
     * 权限请求失败
     */
    override fun permissionRequestFailed() {

    }

    /**
     * 有权限被永久拒绝
     * @param failedPermissions 被拒绝的权限
     * @return 是否跳转到系统权限设置界面
     */
    override fun permissionsAlwaysDenied(failedPermissions: Array<String>): Boolean {
        return true
    }

    /**
     * 权限被用户拒绝
     * @param failedPermissions 被拒绝的权限
     * @return 是否继续进行权限请求
     */
    override fun permissionsDenied(failedPermissions: Array<String>): Boolean {
        return true
    }

    /**
     * 需要请求的权限
     */
    override fun permissionsNeedRequest(): Array<String> {
        return arrayOf(
            "android.permission.ACCESS_COARSE_LOCATION",
            "android.permission.ACCESS_FINE_LOCATION"
        )
    }

    /**
     * 权限请求成功
     */
    override fun permissionsRequested() {
        startActivityWithFinish(Intent(this, MainActivity::class.java))
    }

}